package solution

func V2(strs []string) string {
	if len(strs) <= 0 {
		return ""
	}

	var (
		char   byte
		length = len(strs[0])
		rst    = make([]byte, 0)
	)

	for i := 0; i < length; i++ {
		for n, str := range strs {
			if len(str) < i+1 {
				return string(rst)
			}

			if n == 0 {
				char = str[i]
			}

			if char != str[i] {
				return string(rst)
			}
		}

		rst = append(rst, char)
	}

	return string(rst)
}
